package com.zzyx.service.impl;

import java.util.List;
import java.util.Map;

import com.zzyx.bean.Admin;
import com.zzyx.bean.Uuser;
import com.zzyx.dao.UserDAO;
import com.zzyx.service.UserService;

public class UserServiceImpl implements UserService {
	private UserDAO userDao;

	public void save(Uuser user) {
		userDao.save(user);
	}

	public void delete(Uuser user) {
		userDao.delete(user);
	}

	public void deleteById(Integer id) {
		userDao.deleteById(Uuser.class, id);
	}

	public void update(Uuser user) {
		userDao.saveOrUpdate(user);
	}

	public boolean isExistSameProperty(Map param) {
		return true;
	}

	public Uuser findById(Integer id) {
		return userDao.findById(Uuser.class, id);
	}

	public List<Uuser> findAll() {
		return userDao.findAll(Uuser.class);
	}

	public List<Uuser> findByCondition(Map param, int type) {
		return userDao.findByProperty(Uuser.class, null, null, type);
	}

	public List<Uuser> findByProperty(Class<Uuser> entityClass,
			String propertyName, Object value, int type) {
		return userDao.findByProperty(entityClass, propertyName, value, type);
	}

	public Uuser checkLogin(Uuser user) {
		return userDao.checkLogin(user);
	}

	public void setUserDao(UserDAO userDao) {
		this.userDao = userDao;
	}

	
	public Admin checkAdmin(Admin user) {
		
		return userDao.checkAdmin(user);
	}

	
	public List<Uuser> findByHql(String hql) {
		// TODO Auto-generated method stub
		return userDao.findByHql(hql);
	}

	
	public List<Uuser> findByHql(String hql, int start, int max) {
		// TODO Auto-generated method stub
		return userDao.findByHql(hql,start , max);
	}

	
	public Uuser findUniqueResult(String sql) {
		// TODO Auto-generated method stub
		return userDao.findUniqueResult(sql);
	}

}
